package sample;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.SubScene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

import java.util.Map;
import java.util.stream.Stream;

public class TestSong extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Map<Integer, String> songWords = Utils.getSongWords();
        Button button = new Button("button");
        AnchorPane anchorPane = new AnchorPane();
        anchorPane.setStyle("-fx-background-color: plum");
        Scene scene = new Scene(anchorPane);
        primaryStage.setScene(scene);
        primaryStage.setWidth(1120);
        primaryStage.setHeight(700);
        primaryStage.show();
        PerspectiveCamera perspectiveCamera = new PerspectiveCamera();
//        perspectiveCamera.set
        AnchorPane pane = new AnchorPane();
        SubScene subScene = new SubScene(pane,800,500,false, SceneAntialiasing.BALANCED);
        subScene.setCamera(perspectiveCamera);
        pane.setStyle("-fx-background-color: skyblue");
        VBox vBox = new VBox();
        vBox.setLayoutY(200);
        vBox.setLayoutY(0);
//        AnchorPane.setLeftAnchor(vBox,200.0);
//        AnchorPane.setBottomAnchor(vBox,100.0);
        for(int i=0;i<5;i++) {
            Text text = new Text("yebanfengyu" + i);
            text.setFont(Font.font(40));
            text.setFill(Color.GRAY);
//            text.setTranslateX(500);
            int idx_y = i==0?200:i*50+200;
            if(idx_y == 200){
                text.setTranslateZ(0);
            }else
                text.setTranslateZ(400);
            text.setTranslateY(idx_y);
            vBox.setAlignment(Pos.CENTER);
            vBox.getChildren().add(text);
        }
//            StackPane.setMargin(text,new Insets(10));
//            pane.setPadding(new Insets(10));

        pane.getChildren().add(vBox);


        anchorPane.getChildren().addAll(button,subScene);
    }
}
